<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Add Scheduling</title>
<link rel="stylesheet" type="text/css" href="component/jquery-easyui-1.5.1/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="component/jquery-easyui-1.5.1/themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="component/jquery-easyui-1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="component/jquery-easyui-1.5.1/jquery.easyui.min.js"></script>
</head>

<script type="text/javascript">
function save(){
	$.ajax({
	    type: "get",
	    url:"addScheduling.action",
	    data:$('#addScheduling').serialize()
	    +"&startDate="+$('#startDate').datebox('getValue')
	    +"&endDate="+$('#endDate').datebox('getValue')
	    +"&mycvResume="+$('#mycvResume').datebox('getValue')
	    +"&user_id="+$('#user_id').datebox('getValue'),
	    async: true,
	    error: function(request) {
	      alert("error,fail to update!");
	    },
	    success: function(data) {
	    	alert("success!");
	    	window.location.href = 'searchPage.action?number='+${count+1};
	    }
	});
}
</script>

<body>
	<table border="1">
		<tr>
			<td colspan="1">schedule_name</td>
			<td colspan="1">client</td>
			<td colspan="1">project</td>
			<td colspan="1">role</td>
			<td colspan="1">startDate</td>
			<td colspan="1">endDate</td>
			<td colspan="1">mycvResume</td>
			<td colspan="1">user_id</td>
		</tr>
		<form id="addScheduling" action="addScheduling.action" method="get" >
			<tr>
				<td colspan="1"><input id="schedule_name" name="schedule_name" required="required" type="text"></td>
				<td colspan="1"><input id="client" name="client" required="required" type="text"/></td>
				<td colspan="1"><input id="project" name="project" required="required" type="text"/></td>
				<td colspan="1"><input id="role" name="role" required="required" type="text"/></td>
				<td colspan="1"><input class="easyui-datebox"  id="startDate" name="startDate" value="$('#startDate').datebox('getValue')" type="text"/></td>
				<td colspan="1"><input class="easyui-datebox"  id="endDate" name="endDate" value="$('#endDate').datebox('getValue')" type="text"/></td>
				<td colspan="1"><input class="easyui-datebox"  id="mycvResume" name="mycvResume" value="$('#mycvResume').datebox('getValue')" required="required" type="text"/></td>
				<td colspan="1"><select class="easyui-combobox" id="user_id" name="user_id" style="width:50%;" >
					<c:forEach items="${userList}" var="list">
						<option <c:if test='${scheduling.user_id==list.user_id}'>selected="selected"</c:if>value="${list.user_id}">${list.user_id}</option>							
					</c:forEach>
				</select>			
			</td>				
				</tr>
			<input onclick="save()" type="button" value="Save"/>
		</form>	
	</table>
	
</body>
</html>